/***
 * from表单处理
 */
const fromConfig = {
  spaceSize: 'small', // 表单空间布局大小 default/small/mini
  size: 'default', // 表单内控件大小 large/default/small
  openType: 'dialog', // 打开方式 drawer抽屉 dialog弹窗（默认）
  modelData: {}, // 表单默认值
  showButtons: true, // 显示
  width: '60%',
  // footerButton: [
  //   {
  //     name: '关闭',
  //     value: 'close'
  //   },
  //   {
  //     name: '重置',
  //     value: 'reset'
  //   },
  //   {
  //     type: 'primary',
  //     name: '确定',
  //     value: 'confirm'
  //   }
  // ],
  operationConfig: {
    spaceSize: 'default',
    expand: false,
    inline: true,
    layout: 'vertical',
    labelPosition: 'top',
    mode: 'edit',
    formData: [
      {
        value: '11',
        prop: 'keyword',
        label: '关键词1',
        type: 'text',
        rules: [],
        flex: 3,
        component: {
          placeholder: '请输入关键词'
        }
      },
      {
        value: '',
        prop: 'id',
        label: 'ID',
        type: 'text',
        flex: 2,
        rules: [
          {
            required: true,
            message: 'Please input email address',
            trigger: 'blur'
          },
          {
            type: 'email',
            message: 'Please input correct email address',
            trigger: ['blur', 'change']
          }
        ],
        component: {
          placeholder: '请输入用户ID',
          style: 'min-width: 340px'
        }
      },
      {
        value: '',
        prop: 'name',
        label: '城市',
        type: 'select',
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择城市',
            trigger: 'change'
          }
        ],
        options: () => [
          {
            label: '贵州省',
            value: '111'
          },
          {
            label: '广东省',
            value: '222'
          }
        ],
        component: {
          placeholder: '请输入用户ID',
          style: 'min-width: 340px'
        }
      },
      {
        value: '',
        prop: 'sex',
        label: '性名',
        type: 'radio',
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择你的性别',
            trigger: 'change'
          }
        ],
        options: () => [
          {
            label: '男性',
            value: '1'
          },
          {
            label: '女性',
            value: '0'
          }
        ],
        component: {
          placeholder: '请输入用户ID',
          style: 'min-width: 340px'
        }
      },
      {
        value: [],
        prop: 'hobby',
        label: '爱好',
        type: 'checkbox',
        flex: 2,
        rules: [
          {
            type: 'array',
            required: true,
            message: '请选择你的爱好',
            trigger: 'change'
          }
        ],
        options: () => [
          {
            label: '钓鱼',
            value: '1'
          },
          {
            label: '打蓝球',
            value: '2'
          },
          {
            label: '踢足球',
            value: '3'
          }
        ],
        component: {
          placeholder: '请输入用户ID',
          style: 'min-width: 340px'
        }
      },
      {
        value: true,
        prop: 'states',
        label: '状态',
        type: 'switch',
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'change'
          }
        ]
      },
      {
        value: '',
        prop: 'birthday',
        label: '出生期',
        type: 'date-picker',
        pickerTyep: 'date', //时间类型
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'change'
          }
        ],
        component: {
          placeholder: '请选择时间'
        }
      },
      {
        value: '',
        prop: 'birthdayTime',
        label: '出生期时间',
        type: 'time-picker',
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'change'
          }
        ],
        component: {
          placeholder: '请选择时间'
        }
      },
      {
        value: '',
        prop: 'birthdayEnd',
        label: '结束时间',
        type: 'date-picker',
        pickerTyep: 'datetime', //时间类型
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'change'
          }
        ],
        component: {
          placeholder: '请选择时间'
        },
        shortcuts: [
          {
            text: '当前',
            value: new Date()
          },
          {
            text: '当天',
            value: () => {
              const date = new Date()
              date.setDate(date.getDate() - 1)
              return date
            }
          },
          {
            text: '下周',
            value: () => {
              const date = new Date()
              date.setDate(date.getDate() - 7)
              return date
            }
          }
        ]
      },
      {
        value: '',
        prop: 'img',
        label: '头像',
        type: 'upload',
        flex: 2
      },
      {
        value: '',
        prop: 'treeSelect',
        label: '树状选择器',
        type: 'tree-select',
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'change'
          }
        ],
        component: {
          placeholder: '请选择时间',
          style: 'min-width: 340px'
        },
        options: () => {
          const treeSelectData = <unknown>[
            {
              value: '1',
              label: 'Level one 1',
              children: [
                {
                  value: '1-1',
                  label: 'Level two 1-1',
                  children: [
                    {
                      value: '1-1-1',
                      label: 'Level three 1-1-1'
                    }
                  ]
                }
              ]
            },
            {
              value: '2',
              label: 'Level one 2',
              children: [
                {
                  value: '2-1',
                  label: 'Level two 2-1',
                  children: [
                    {
                      value: '2-1-1',
                      label: 'Level three 2-1-1'
                    }
                  ]
                },
                {
                  value: '2-2',
                  label: 'Level two 2-2',
                  children: [
                    {
                      value: '2-2-1',
                      label: 'Level three 2-2-1'
                    }
                  ]
                }
              ]
            },
            {
              value: '3',
              label: 'Level one 3',
              children: [
                {
                  value: '3-1',
                  label: 'Level two 3-1',
                  children: [
                    {
                      value: '3-1-1',
                      label: 'Level three 3-1-1'
                    }
                  ]
                },
                {
                  value: '3-2',
                  label: 'Level two 3-2',
                  children: [
                    {
                      value: '3-2-1',
                      label: 'Level three 3-2-1'
                    }
                  ]
                }
              ]
            }
          ]
          return treeSelectData
        }
      },
      {
        value: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
        prop: 'endTime',
        label: '日期',
        type: 'time-picker',
        flex: 2,
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'change'
          }
        ],
        component: {
          placeholder: '请选择时间',
          isRange: true,
          arrowControl: true,
          rangeseparator: 'To',
          startPlaceholder: '开时间',
          endPlaceholder: '结束时间'
        }
      }
    ]
  }
}
export default fromConfig
